﻿using System;
using System.Data;
using System.Collections.Generic;
using He.Model;
using He.Common;
namespace He.BLL
{
    /// <summary>
    /// channel
    /// </summary>
    public partial class channel
    {
        #region  Method


        /// <summary>
        /// 修改一列数据
        /// </summary>
        public void UpdateField(int id, string strValue)
        {
            dal.UpdateField(id, strValue);
        }

        /// <summary>
        /// 得到一个对象实体，从缓存中
        /// </summary>
        public He.Model.channel GetModelByCache(int Id)
        {
            string CacheKey = SysKeys.CHANNEL_CACHE_PREFIX + Id;
            object objModel = CacheHelper.Get(CacheKey);
            if (objModel == null)
            {
                objModel = dal.GetModel(Id);
                if (objModel != null)
                {
                    int ModelCache = 10;
                    CacheHelper.Set(CacheKey, objModel, DateTime.Now.AddDays(ModelCache), TimeSpan.Zero);
                }
            }
            return (He.Model.channel)objModel;
        }

        /// <summary>
        /// 得到一个对象实体，从缓存中
        /// </summary>
        public He.Model.channel GetModel(string name)
        {
            string cacheKey = SysKeys.CHANNEL_CACHE_PREFIX + name;
            Model.channel model = CacheHelper.Get(cacheKey) as Model.channel;
            if (model == null)
            {
                model = dal.GetModel(name);
                CacheHelper.Add(cacheKey, model);
            }
            return model;
        }
        #endregion  Method
    }

}

